#include "gamewindow.h"
#include "ui_gamewindow.h"

GameWindow::GameWindow(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::GameWindow)
{

	//设置界面大小和背景，setmouseTracking为接受鼠标移动
	ui->setupUi(this);

	setFixedSize(660,660);

	//画板
	QPainter painter(this);

	painter.setRenderHint(QPainter::Antialiasing,true); //抗锯齿

	painter.drawRect(20,40,600,600);

	setWindowTitle("人人对战");

	//设置鼠标移动
	setMouseTracking(true);

}

void GameWindow::mousePressEvent(QMouseEvent *e,Block *b)
{
	x=e->pos().rx();
	y=e->pos().ry();
	b->setGeometry(x,y,50,50);
}

GameWindow::~GameWindow()
{
}
